package cn.wolfcode.rbac.domain;

import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@Data
public class Employee extends BaseDomain{
    private String name;
    private String password;
    private String email;
    private Integer age;
    private boolean admin;
    private Department dept;
    //增加人员的角色，
    private List<Role> roles = new ArrayList<>();
    //使用fastJson来生成
    public String getJson(){
        HashMap map = new HashMap();
        map.put("id",id);
        map.put("name",name);
        map.put("password",password);
        map.put("email",email);
        map.put("age",age);
        map.put("admin",admin);
        map.put("dept",dept);
        map.put("roles",roles);
        return JSON.toJSONString(map);
    }
}
